#ifndef FND_GAME_CAR_ROAD_INFO_MANAGER_H
#define FND_GAME_CAR_ROAD_INFO_MANAGER_H
#include "node_record_manager.h"
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <map>

class car_road_info_manager : boost::noncopyable {
public:
    car_road_info_manager(const char* file_name) ;
private:
    bool bind_file(const char* file_name) ;
public:
    const normal_number_range* current_position(int car_id) const ;
    float current_x(int car_id) const ;
    float current_y(int car_id) const ;
    int current_round(int car_id) const ;
    float next_x(int car_id, int index = 1) const ;
    float next_y(int car_id, int index = 1) const ;
    const normal_number_range* next_pos(int car_id, int index = 1) const ;
    const normal_number_range* prev_pos(int car_id, int index = 1) const ;
    void move_to_next(int car_id) ;
    void move_to_prev(int car_id) ;
    void move_to_begin(int car_id) ;
    void move_to_end(int car_id) ;
    bool next_is_valid(int car_id) const ;
    bool prev_is_valid(int car_id) const ;
    
    bool has_car_id(int car_id) const ;
    void reset(int car_id) ;
    void bind_car(int car_id) ;
private:
    mutable std::map<int, int> m_id_roadpoint ;
    bool is_valid(int id) const ;
    bool m_is_read_file ;
    Utility::node_record_manager m_nodeMgr ;
    
} ;
#endif

